<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core" 
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"> 

<h:head>
	<title>Consulta Restaurante</title>
	<link rel="stylesheet" href="../../../resources/styles/layout.css" type="text/css"/>
	
</h:head>

<h:body>
	<h:form id="form1">
	<div class="wrapper row1">
	  <header id="header" class="clear">
	    <hgroup>
	      <h1><a href="index.html">Cardápio Mobile</a></h1>
	      <h2>Seu cardápio para o mundo todo </h2>
	    </hgroup>
			<fieldset class="fl_right">
		    	<p:panel style="width:300px;height:50px;right:200px;top:60px;background:#696969;border:1px solid black">  
			    	<h:outputLabel style="font-weight:bold;color:#FFFFE0;" value="Usuário:"/>
					<h:outputLabel style="font-weight:bold;color:#FFA500;" value="#{loginMB.getSessao('NomeUsuario')}"/>  
					<fieldset>		
						<h:outputLabel value="Restaurante:" style="font-weight:bold;color:#FFFFE0;"/>  
						<h:outputLabel style="font-weight:bold;color:#FFA500;" value="#{loginMB.getSessao('NomeFantasia')}"/>
					</fieldset>  
				</p:panel> 
			</fieldset>
			<fieldset>
			<p></p>
			</fieldset>
			
	    <nav class="clear">
	      <ul>
	        <li class="active"><a href="#">Minha Conta</a>
	          <ul>
	            <li><a href="portalCardapioMundo.jsf">Portal Home</a></li>
	            <li><a href="../user/meusDados.jsf">Meus Dados</a></li>
	            <li><a href="portalCardapioMundo.jsf?changeAccess=EEN013550">Trocar Acesso</a></li>
	            <li onclick="PF('dlgSair').show()"><a href="#">Sair</a></li>
	            <li><a href="#"></a></li>
	          </ul>
	        </li>
	        
	        <li><a href="#">Acesso</a>
	          <ul>
	            <li><a href="../admin/cadUsuario.jsf">Novo Usuário</a></li>
	            <li><a href="consUsuario.jsf">Consulta Usuários</a></li>
	            <li><a href="#"></a></li>
	          </ul>
	        </li>
	        
	        <li><a href="#">Restaurante</a>
	          <ul>
	            <li><a href="../admin/cadRestauranteFilial.jsf">Novo Restaurante</a></li>
	            <li><a href="consRestaurante.jsf">Consulta Restaurante</a></li>
	            <li><a href="#"></a></li>
	          </ul>
	        </li>

	        <li><a href="#">Cardápio</a>
	          <ul>
	            <li><a href="#">Novo Cardápio</a></li>
	            <li><a href="#">Cardápios</a></li>
	            <li><a href="#"></a></li>
	          </ul>
	        </li>

	        <li><a href="#">Business Intelligence</a>
	          <ul>
	            <li><a href="#">Avaliações Cardápio</a></li>
	            <li><a href="#">Avaliações Atendimento</a></li>
	            <li><a href="#">Avaliações Infraestrutura</a></li>
	            <li><a href="#">Avaliação Geral</a></li>
	            <li><a href="#"></a></li>
	          </ul>
	        </li>

	        <li><a href="#">Pagamento</a>
	          <ul>
	            <li><a href="#">Meus Pagamentos</a></li>
	          </ul>
	        </li>
	        <li><a href="#">Plano</a>
	          <ul>
	            <li><a href="#">Meu Plano</a></li>
	            <li><a href="#">Renovação</a></li>
	            <li><a href="#">Novos Planos</a></li>
	          </ul>
	        </li>
	        
	      </ul>
	    </nav>
	  </header>
	</div>
	
	
	<p:dialog id="dialogSair" header="Opção Logout" modal="true" height="85" width="510" widgetVar="dlgSair" resizable="false" 
	showEffect="fade" hideEffect="fade">  
		<h:panelGrid columns="2" cellpadding="5">  
			<h:outputLabel for="username" value="Deseja desconectar do portal Cardápio Mobile ?" style="font-size:15px"/>
		</h:panelGrid>
				          
		<f:facet name="footer">  
			<p class="fl_left">
			<p:commandButton id="cancelarButton" value="Cancelar" height="50" width="50" onclick="PF(dlgSair).hide();"/>
			</p>
			<p class="fl_right">
				<p:commandButton id="sairButton" value="Sair" height="50" width="50" actionListener="#{acessoMB.logout}"/>
			</p>  
		</f:facet>  
    </p:dialog>
	</h:form> 
	
	    <!-- ########################################################################################## -->

	<div class="wrapper row2">
	    <div id="container" class="clear"> 
	    <div id="homepage"> 
	    	<h:form id="form2">
	    
	    		<p:growl id="messages" showDetail="true"/>  
	    		<p:growl id="growl" showDetail="true"/>
   
				<p:panel header="CONSULTA RESTAURANTE" style="color: red;font-size:15px;font-weight:bold;background-color:Gray">

				  				<p:toolbar>  
			    					<p:toolbarGroup align="left">  

								        <p:commandButton actionListener="#{restauranteMB.salvaAlteracao}" title="Salvar" 
								        icon="ui-iconSave" validateClient="true" ajax="false" disabled="#{restauranteMB.controleAlteracao}"/>

								         <p:separator />  

						  				<p:commandButton  title="Alterar" icon="ui-iconEditar"
						  				action="#{restauranteMB.setStatusAlterar(false)}" ajax="true" update="@form2" disabled="#{restauranteMB.controleAlteracaoBtnEdit}"/>
						  				
								         <p:separator />  

								        <p:commandButton title="Cancelar" icon="ui-iconCancela" 
						  				action="#{restauranteMB.setStatusAlterar(true)}" ajax="true" update="@form2" disabled="#{restauranteMB.controleAlteracao}"/>
								         <p:separator />  
							    	</p:toolbarGroup>  

					  			</p:toolbar> 
					<br/>
					   
	   				<!--  <p:tabView effect="fade" effectDuration="normal" style="height:470px" >-->
	   				<p:tabView effect="fade" effectDuration="normal">

		   				<p:tab title="Dados Jurídicos">  
			
			  				<h:panelGrid columns="2" cellpadding="10">  
							
							 	<h:outputText for="rzSocial" value="#{msgs.RzSocial}"/>
						        <p:inputText id="rzSocial" size="60" required="true" value="#{restauranteMB.restauranteVO.rzSocial}" label="#{msgs.dRzSocial}"
						        disabled="#{restauranteMB.statusAlterar}"/>
	
							 	<h:outputText for="insEstadual" value="#{msgs.InsEstadual}"/>
						        <p:inputText id="insEstadual" size="30" required="true" value="#{restauranteMB.restauranteVO.insEstadual}" label="#{msgs.dInsEstadual}"
						        disabled="#{restauranteMB.statusAlterar}"/>
	
								
							 	<h:outputText for="cnpj" value="#{msgs.CNPJ}"/>
						        <p:inputMask id="cnpj" size="30" value="#{restauranteMB.restauranteVO.cnpj}" maxlength="20" mask="99.999.999/9999-99"  
						        label="#{msgs.dCNPJ}" converter="retiraMaskConverter" required="true" disabled="#{restauranteMB.statusCNPJAlterar}" >
						        	<f:validator validatorId="validator.CnpjValidator" />
						        </p:inputMask>
	
							 	<h:outputText for="fantasia" value="#{msgs.NmFantasia}"/>
						        <p:inputText id="nmFantasia" size="60" value="#{restauranteMB.restauranteVO.nomeFantasia}" 
						        label="#{msgs.dNmFantasia}" required="true" disabled="#{restauranteMB.statusAlterar}"/>
							         
			
			  				 </h:panelGrid>
			  			</p:tab>
							
						<p:tab title="Dados Proprietário">  
		
			  				<h:panelGrid id="gridProprietario" columns="2" cellpadding="10">  
	
								 	<h:outputText for="proprietario" value="#{msgs.Proprietario}"/>
							        <p:inputText id="proprietario" size="60" value="#{restauranteMB.restauranteVO.proprietario}" 
							        label="#{msgs.dProprietario}" disabled="#{restauranteMB.statusAlterar}"/>
	
					            	<h:outputText for="mail" value="#{msgs.emailUsuario}" />
					            	<p:inputText id="mail" value="#{restauranteMB.restauranteVO.mail}" label="#{msgs.dEmailUsuario}" disabled="#{restauranteMB.statusAlterar}"
					            		validatorMessage="Formato de E-mail invalido" size="30">  
										<f:validateRegex pattern="^[_A-Za-z0-9-\+]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9]+)*(\.[A-Za-z]{2,})$"/>
									</p:inputText> 
		
								 	<h:outputText for="fone1" value="#{msgs.Fone1}"/>
							        <p:inputMask id="fone1" size="15" value="#{restauranteMB.restauranteVO.fone1}" label="#{msgs.dFone1}" mask="(99) 99999-9999" 
							        disabled="#{restauranteMB.statusAlterar}"/>
		
								 	<h:outputText for="fone2" value="#{msgs.Fone2}"/>
							        <p:inputMask id="fone2" size="15" value="#{restauranteMB.restauranteVO.fone2}" mask="(99) 9999-9999" 
							        disabled="#{restauranteMB.statusAlterar}"/>
	
					        </h:panelGrid>
					     </p:tab>   
		           		
						<p:tab title="Dados Localização">  
							<h:panelGrid id="gridLocalizacao" style="height:150px">  
	
								<h:form id="formLocalizacao">			        			         
						           	<h:panelGrid id="gridCep" columns="3" columnClasses="gridFindCol1With1-3Col,gridFindCol2With1-3Col,gridFindCol3With1-3Col"> 
							           	<h:outputText for="cep" value="#{msgs.CEP}"/>
								        <p:inputText id="cep" size="20" value="#{restauranteMB.enderecoVO.cep}" label="#{msgs.dCEP}" required="true"
								        disabled="#{restauranteMB.statusAlterar}"/>
			
										<p:commandLink id="buscaEnd"  title="Busca Endereço" ajax="true"
										actionListener="#{restauranteMB.loadEnderecoCorreios}" update="gridEndereco,gridBairro,gridCidade"
										disabled="#{restauranteMB.statusAlterar}">  
										    <p:graphicImage width="30" height="30" value="../../../resources/icones/search.ico"/>
										</p:commandLink>
			
									</h:panelGrid>
			
								    <h:panelGrid id="gridEndereco" columns="4" columnClasses="gridFindCol1With1-4Col,gridFindCol2With1-4Col,gridFindCol3With1-4Col,gridFindCol4With1-4Col"> 
										<h:outputText for="endereco" value="#{msgs.Endereco}"/>
										<p:inputText id="endereco" size="60" value="#{restauranteMB.enderecoVO.logradouro}" label="#{msgs.dEndereco}"
										disabled="#{restauranteMB.statusAlterar}"/>
					
										<h:outputText for="numero" value="#{msgs.Numero}"/>
										<p:inputText id="numero" maxlength="4" size="4" required="true" value="#{restauranteMB.enderecoVO.numero}" label="#{msgs.dNumero}"
										disabled="#{restauranteMB.statusAlterar}"/>
					 				</h:panelGrid>
					 				
							        <h:panelGrid id="gridBairro" columns="2" columnClasses="gridFindCol1With1-2Col,gridFindCol2With1-2Col">
										<h:outputText for="bairro" value="#{msgs.Bairro}"/>
									    <p:inputText id="bairro" size="30" value="#{restauranteMB.enderecoVO.bairro}" label="#{msgs.dBairro}"
									    disabled="#{restauranteMB.statusAlterar}"/>
									</h:panelGrid>
				
									<h:panelGrid id="gridCidade" columns="4" columnClasses="gridFindCol1With1-4Col,gridFindCol2With1-4Col,gridFindCol3With1-4Col,gridFindCol4With1-4Col"> 
				
										<h:outputText for="cidade" value="#{msgs.Cidade}"/>
										<p:inputText id="cidade" size="60" value="#{restauranteMB.enderecoVO.cidade}" label="#{msgs.dCidade}"
										disabled="#{restauranteMB.statusAlterar}"/>
					
										<h:outputText for="UF" value="#{msgs.UF}"/>
										<p:inputText id="uf" size="4" value="#{restauranteMB.enderecoVO.estado}" label="#{msgs.dUF}"
										disabled="#{restauranteMB.statusAlterar}"/>
			
									</h:panelGrid>
								</h:form>					
						  </h:panelGrid>	 
		     			</p:tab>
		     			
		     			<p:tab title="Dados Caraterísticas">  
 						    <h:panelGrid id="gridCaracteristica" columns="2" columnClasses="gridCol1With1-2Col,gridCol2With1-2Col"> 

								<h:outputText for="tipo" value="#{msgs.TipoRest}"/>
							    <h:selectOneMenu id="tipoRestaurante" value="#{restauranteMB.restauranteVO.idTipoRestaurante}" style="width:100%">
						           	<f:selectItem itemLabel="Select One" itemValue=""/>
										<f:selectItems value="#{restauranteMB.loadTipoRestaurante()}" var="tipoRestaurante" itemLabel="#{tipoRestaurante.tipo}" 
											itemValue="#{tipoRestaurante.idRestauranteTipoSys}"/>  
								</h:selectOneMenu>
			
								<h:outputText for="culinaria" value="#{msgs.CulinariaRest}"/>
							    <h:selectOneMenu id="culinariaRestaurante" value="#{restauranteMB.restauranteVO.idCulinariaRestaurante}" style="width:100%">
						           	<f:selectItem itemLabel="Select One" itemValue=""/>
										<f:selectItems value="#{restauranteMB.loadCulinariaRestaurante()}" var="culinariaRestaurante" itemLabel="#{culinariaRestaurante.culinaria}" 
											itemValue="#{culinariaRestaurante.idRestauranteCulinariaSys}"/>  
								</h:selectOneMenu>

								<h:outputText for="servico" value="#{msgs.ServicoRest}"/>
							    <h:selectOneMenu id="servicoRestaurante" value="#{restauranteMB.restauranteVO.idServicoRestaurante}" style="width:100%">
						           	<f:selectItem itemLabel="Select One" itemValue=""/>
										<f:selectItems value="#{restauranteMB.loadServicoRestaurante()}" var="servicoRestaurante" itemLabel="#{servicoRestaurante.servico}" 
											itemValue="#{servicoRestaurante.idRestauranteServicoSys}" style="width:50%;"/>  
								</h:selectOneMenu>
							</h:panelGrid>
							
								<p:pickList id="estruturaPickList" value="#{restauranteMB.estruturaPickerView}" var="estruturaEntity"   
						                    itemValue="#{estruturaEntity}" style="width:100%" converter="estruturaPickListConverter">
						                    
						  
								        <f:facet name="sourceCaption">Recursos</f:facet>  
								        <f:facet name="targetCaption">Disponibilidade</f:facet>  
								  
								        <p:ajax event="transfer"  listener="#{restauranteMB.onTransfer}"/>  
								  
							            <p:column style="width:80px"> 
								           	#{estruturaEntity.estrutura}  
								        </p:column>  
						    	</p:pickList>  
		     			</p:tab>
		     			
		     			
		     			<p:tab title="Dados Ativação">  
							<h:panelGrid id="gridAtivacao" columns="2" columnClasses="gridFindCol1With1-2Col,gridFindCol2With1-2Col">  

								<h:outputText for="DtAtivacao" value="#{msgs.DtAtivacao}"/>
								<p:inputText id="dtAtivacao" size="10" value="#{restauranteMB.restauranteVO.dataInc}" label="#{msgs.DtAtivacao}" disabled="true"/>

								<h:outputText for="DtExpira" value="#{msgs.DtExpira}"/>
								<p:inputText id="dtExpira" size="10" value="#{restauranteMB.restauranteVO.dataExpira}" label="#{msgs.DtExpira}" disabled="true"/>

								<h:outputText for="status" value="#{msgs.statusCons}"/>
								<p:inputText id="status" size="15" value="#{restauranteMB.restauranteVO.status}" label="#{msgs.statusCons}" disabled="true"/>
       						</h:panelGrid>  
									
							<p:commandButton value="Inativar Restaurante"  id="btnCancelaRestaurante"
							icon="ui-iconDesativa" oncomplete="dlgInativar.show()" style="background-color: #CD5C5C" 
							rendered="#{restauranteMB.restauranteVO.status.equals('ATIVO')}"/>
								  		
							<p:commandButton value="Ativar Restaurante" id="btnAtivaRestaurante"
							icon="ui-iconAtiva" oncomplete="dlgAtivar.show()" style="background-color: #228B22" 
							rendered="#{restauranteMB.restauranteVO.status.equals('INATIVO')}" />
							
		     			</p:tab>
	  				</p:tabView>
	  			</p:panel>  
	  			
	  			
	  				<p:dialog id="dialogInativa" header="Inativação Restaurante" modal="true" 
 					height="85" width="510" widgetVar="dlgInativar" resizable="false" showEffect="fade" hideEffect="fade">  
				        <h:panelGrid columns="2" cellpadding="5">  
				            <h:outputLabel for="inativar" value="Deseja realmente inativar do sistema o Restaurante #{restauranteMB.restauranteVO.nomeFantasia} ?" 
				            style="font-size:15px"/>
				        </h:panelGrid>
				          
				        <f:facet name="footer">  
				            	<p class="fl_left">
					                <p:commandButton id="butnCancelInativacao" value="Cancelar"   
										height="50" width="50" onclick="dlgInativar.hide();"/>
					            </p>
								<p class="fl_right">
					                <p:commandButton id="btnConfirmaInativacao" value="Inativar"   
					                    height="50" width="50" actionListener="#{restauranteMB.inativaRestaurante}"/>
								</p>  
				            </f:facet>  
    				</p:dialog> 
	  			
	  			
	  				<p:dialog id="dialogAtiva" header="Ativação Cardápio" modal="true" 
 					height="85" width="510" widgetVar="dlgAtivar" resizable="false" showEffect="fade" hideEffect="fade">  
				        <h:panelGrid columns="2" cellpadding="5" styleClass="ui-panelgrid">  
				            <h:outputLabel for="ativar" value="Deseja ativar no sistema o cardápio?" 
				            style="font-size:15px"/>
				        </h:panelGrid>
				          
				        <f:facet name="footer">  
				            	<p class="fl_left">
					                <p:commandButton id="butnCancelAtivacao" value="Cancelar"   
										height="50" width="50" onclick="dlgAtivar.hide();"/>
					            </p>
								<p class="fl_right">
					                <p:commandButton id="btnConfirmaAtivacao" value="Ativar"   
					                    height="50" width="50" actionListener="#{restauranteMB.ativaRestaurante}"/>
								</p>  
				            </f:facet>  
    				</p:dialog> 
  			</h:form>
		</div>
	 	</div>
	</div>

	<!-- Copyright -->
	<div class="wrapper row4">
	  <footer id="copyright" class="clear">
	    <p class="fl_left">Copyright 2014 - All Rights Reserved - <a href="#">W7VM</a></p>
	    <p class="fl_right">W7VM <a href="http://www.w7vm.com/" title="Developer Application Mobile">Developer Application Mobile</a></p>
	  </footer>
	</div>
</h:body>
</html>